﻿package fxLib
{
	import fl.motion.Color;
	import fl.transitions.Tween;
	import fl.transitions.TweenEvent;
	import fl.transitions.easing.*;
	
	import flash.display.MovieClip;
	
	public class FXPulseBrightness extends FXPulseAlpha
	{
		// constructor
		public function FXPulseBrightness( acMCtoPulse:MovieClip, acParams:Object = null )
		{
			if (!acParams)
			{
				acParams = {};
			}
			
			// accept parameters if given, in Object format
			if (acParams != null)
			{
				if ( !isNaN( acParams.minBrightness ) )
					mnAlphaMin          = acParams.minBrightness;
				
				if ( !isNaN( acParams.maxBrightness ) )
					mnAlphaMax          = acParams.maxBrightness;
				
				if ( !isNaN( acParams.startBrightness ) )
					mnAlphaMin          = acParams.startBrightness;
				
				if ( !isNaN( acParams.endBrightness ) )
					mnAlphaMax          = acParams.endBrightness;
				
			}
			
			acParams.minAlpha   = mnAlphaMin;
			acParams.maxAlpha   = mnAlphaMax;
			
			super( acMCtoPulse, acParams ); // super will take it from here
		}
		
		// set the brightness
		override public function set updateAlpha( newValue:Number ):void
		{
			var color:Color = new Color();
			color.brightness = newValue;
			//trace("updateBrightness: "+newValue);
			
			mcPulseObject.transform.colorTransform = color; 		
		}
		
		//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
		
		// getters and setters for all properties
		
		public function set minBrightness( anBrightnessMin:Number ):void
		{
			mnAlphaMin = anBrightnessMin;
		}
		
		public function get minBrightness():Number
		{
			return mnAlphaMin;
		}
		
		public function set maxBrightness( anBrightnessmax:Number ):void
		{
			mnAlphaMax = anBrightnessmax;
		}
		
		public function get maxBrightness():Number
		{
			return mnAlphaMax;
		}
		
		public function set startBrightness( anBrightnessStart:Number ):void
		{
			mnAlphaMin = anBrightnessStart;
		}
		
		public function get startBrightness():Number
		{
			return mnAlphaMin;
		}
		
		public function set endBrightness( anBrightnessend:Number ):void
		{
			mnAlphaMax = anBrightnessend;
		}
		
		public function get endBrightness():Number
		{
			return mnAlphaMax;
		}
		
		//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
		
	}
}